package com.feilong.edgeAI.remind.room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;


import com.feilong.edgeAI.remind.room.bean.RemindBean;

import java.util.List;

@Dao
public interface RemindDao {

    /**
     * 查询所有
     *
     * @return
     */
    @Query("SELECT * FROM REMIND")
    List<RemindBean> getRemindAll();

    /**
     * 根据指定字段查询
     *
     * @return
     */
    @Query("SELECT * FROM REMIND WHERE  TIME = :time")
    List<RemindBean> loadRemindByTimes(String time);

    @Query("SELECT * FROM REMIND WHERE  DAY = :day")
    List<RemindBean> loadRemindByDays(String day);

    @Query("SELECT * FROM REMIND WHERE  MODE = :mode")
    List<RemindBean> loadRemindByModes(String mode);
    /**
     * 项数据库添加数据
     *
     * @param remindBeans
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertAll(List<RemindBean> remindBeans);

    /**
     * 修改数据
     *
     * @param remindBean
     */
    @Update()
    void update(RemindBean remindBean);

    /**
     * 删除数据
     *
     * @param remindBean
     */
    @Delete()
    void delete(RemindBean remindBean);
}
